package cn.linjianhui.interview.patterns.factory;

public class Factory {
    public Phone createPhone(String phoneName) {
        if ("HuaWei".equals(phoneName)) {
            return new HuaWei();
        } else if ("IPhone".equals(phoneName)) {
            return new IPhone();
        } else {
            return null;
        }
    }

    public static void main(String[] args) {
        Factory factory = new Factory();
        Phone phone = factory.createPhone("HuaWei");
        System.out.println(phone.brand());
    }
}
